import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/save',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/submit',
    method: 'post',
    data: row
  })
}

// 第2层 二维码状态
export const updateIsOn = (rqCode, isOn) => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/update',
    method: 'post',
    params: {
      rqCode,
      isOn
    }
  })
}
// 第1层 启用
export const updateIsOnOne = (rqBatchNumber, isOn) => {
  return request({
    url: '/api/rb-core/core/batchCode/batch_code/update',
    method: 'post',
    data: {
      rqBatchNumber,
      isOn
    }
  })
}

export const compPayList = () => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/compPayList',
    method: 'get',
  })
}

export const getPhone = () => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/phone',
    method: 'get',
  })
}


/*export const qrcodeDownload = () => {
  return request({
    url: '/api/rb-core/core/qrcode/qrcode/exportShow',
    method: 'post',
    responseType: 'blob',
  })
}*/

// export const getBatchList = (current, size, params) => {
//   return request({
//     url: '/api/rb-core/core/qrcode/qrcode/batchList',
//     method: 'get',
//     params: {
//       ...params,
//       current,
//       size,
//     }
//   })
// }
export const getBatchList = (current, size, params) => {
  return request({
    url: '/api/rb-core/core/batchCode/batch_code/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 二维码 第一次list 导出 */
export const getExport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-core/core/qrcode/qrcode/export',
    method: 'get',
    params: {
      ...params,
    }
  })
}
